import React from 'react';
import ReactDOM from 'react-dom';
import { backstageUrl, baseUrl } from "./config.js";
import Axios from "axios";


Axios.defaults.baseURL = baseUrl;
//获取学校的所有巡更班组以及对应班组成员信息、每人巡更总次数并排序
export let getAllPatrolClassAndUserInfoPerSchool = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getAllPatrolClassAndUserInfoPerSchool", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
//获取学校的所有巡更班组对应成员信息、每人巡更总次数并排序(通过时间)
export let getPatrolCountAndMemberRankPerSchoolByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getPatrolCountAndMemberRankPerSchoolByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
//通过时间获取学校已参与巡更班组完成率(已完成巡更计划数/总计划数)
export let getPatrolClassCompletionPerSchoolByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getPatrolClassCompletionPerSchoolByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
//通过时间获取巡更班组成员个人准确率
export let getPatrolClassUserAccuracyPerSchoolByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getPatrolClassUserAccuracyPerSchoolByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
//通过时间获取累计隐患次数、已处理隐患次数、处理率
export let getAllHiddenDangerInfo = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getAllHiddenDangerInfo", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
//通过时间获取累计隐患次数、已处理隐患次数、处理率
export let getClassHiddenDangeInfoByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getClassHiddenDangeInfoByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
export let getHiddenDangerItemInfoByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getHiddenDangerItemInfoByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}
export let getHiddenDangerItemDetailByTime = (schoolId, startTime, endTime) => {
    return (
        Axios.post("StatisticsReport/getHiddenDangerItemDetailByTime", {
            schoolId: schoolId,
            startTime: startTime,
            endTime: endTime
        })
    );
}


//===============================================================巡检================================================
export let getAllInspectClassAndMemberApi = (departmentId) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getAllInspectClassAndMember", {
            params: {
                departmentId: departmentId
            }
        })
    );
};


export let getInspectClassMemberAndNumberApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectClassMemberAndNumber", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    );
};


export let getInspectAddressAndClassMemberApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectAddressAndClassMember", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    );
};

export let getInspectCategoryItemNumberApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectCategoryItemNumber", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    );
};


export let getInspectCategoryAndItemApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectCategoryAndItem", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    );
};

export let getInspectClassWorkPlanRankApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectClassWorkPlanRank", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    );
};


export let getInspectPercentCountApi = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getInspectPercentCount", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}
//-----------------------------------------导出word-------------------------------------

export let exportPatrolWord = (imageBase64List, startTime, endTime, departmentId) => {
    return (
        Axios.post(backstageUrl + "StatisticsReport/exportPatrolWord", {
                imageBase64List : imageBase64List,
                startTime: startTime,
                endTime: endTime,
                departmentId: departmentId,
        })
    );
};
export let exportInspectWord = (imageBase64List, startTime, endTime, departmentId) => {
    return (
        Axios.post(backstageUrl + "StatisticsReport/exportInspectWord", {
                imageBase64List : imageBase64List,
                startTime: startTime,
                endTime: endTime,
                departmentId: departmentId,
        })
    );
};
export let exportDutyWeekWord = (startTime, endTime, departmentId) => {
    return (
        Axios.post(backstageUrl + "StatisticsReport/exportDutyWeekWord", {
                startTime: startTime,
                endTime: endTime,
                departmentId: departmentId,
        })
    );
};

export let downloadWord = (fileType) => {
    return (
        Axios.post(baseUrl + "StatisticsReport/downloadWord", {
            responseType: "blob",
            fileType : fileType
        })
    );
};

//---------------------------值周接口
//标题---总体情况统计
export let getDutyWeekAllInfoByTime = (departmentId, startTime, endTime) =>{
    return (
        Axios.get(baseUrl + "StatisticsReport/getDutyWeekAllInfoByTime", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}

//值周检查点与值周任务汇总---值周检查点与值周地址关联信息获取
export let getDutyWeekCheckPointInfo = (departmentId) =>{
    return (
        Axios.get(baseUrl + "StatisticsReport/getDutyWeekCheckPointInfo", {
            params: {
                departmentId: departmentId
            }
        })
    )
}

//值周检查点与值周任务汇总---值周任务与值周项关联
export let getDutyWeekContentAndItem = (departmentId) =>{
    return (
        Axios.get(baseUrl + "StatisticsReport/getDutyWeekContentAndItem", {
            params: {
                departmentId: departmentId
            }
        })
    )
}

//值周教师与值周巡查次数统计
export let getDutyWeekCheckNumRankByTime = (departmentId, startTime, endTime) =>{
    return (
        Axios.get(baseUrl + "StatisticsReport/getDutyWeekCheckNumRankByTime", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}
//值周巡查问题扣分统计
export let getDutyWeekDeductionRankByTime = (departmentId, startTime, endTime) =>{
    return (
        Axios.get(baseUrl + "StatisticsReport/getDutyWeekDeductionRankByTime", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}


//我校xxx位值周教师共上报xxx个问题
export let getAllPersonnelAndQuestion = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getAllPersonnelAndQuestion", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}

//xxx发现的问题最多，共计xxx次，xxx发现的问题最少，为xxx次
export let getQuestionAndPersonnelRank = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getQuestionAndPersonnelRank", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}

//其中在xxx处发现的问题最多，共计xxx个。在xxx发现的问题最少，为xxx个。
export let getAddressAndQuestionRank = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getAddressAndQuestionRank", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}


//发现问题最多的值周项是xxx，共计xxx次，发现问题最少的值周项是xxx，为xxx次
export let getQuestionItemRank = (departmentId, startTime, endTime) => {
    return (
        Axios.get(baseUrl + "StatisticsReport/getQuestionItemRank", {
            params: {
                departmentId: departmentId,
                startTime: startTime,
                endTime: endTime
            }
        })
    )
}



